package com.ruipengkj.component.jpanel;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.TexturePaint;

import javax.swing.JPanel;

import com.ruipengkj.commons.util.Util;
/**
 * 图片重绘面板
 * */
public class RepeatImagePanel extends JPanel {
	
	private static final long serialVersionUID = 1L;
	private TexturePaint paint =null;
	public RepeatImagePanel(Image image){
		paint=Util.createTexturePaint(image);
	}
	
	@Override
	protected void paintComponent(Graphics g) {

		Graphics2D g2d = (Graphics2D) g;
		g2d.setPaint(paint);
		g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
	}
}
